/*
 * close_el.cpp
 * Copyright Eduardo Aponte 2013
 * aponteeduardo@gmail.com
 */

#include "mex.h"
#include <string.h>
#include <eyelink.h>

void initEyeLink( void )
{         
    

/* Code for the setup, recording, and cleanups */
    
    /* Now, the following code closes the eyelink connection */
    /* Checks whether we still have the connection to the tracker */
    
    if(eyelink_is_connected())
    {
        /* Places EyeLink tracker in off-line (idle) mode */
        set_offline_mode();
        /* disconnect from tracker */
        eyelink_close(1);
    }
    
    /* shut down system (MUST do before exiting) */
    close_eyelink_system();
}


void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
    /* Verify input arguments. */
    if(nrhs < 1 || nrhs > 2) {
        mexErrMsgTxt("Incorrect number of inputs");
    } else if(nlhs>1) {
        mexErrMsgTxt("Too many output arguments.");
    }
    
    if ( !mxIsNumeric(prhs[0]) ){
        mexErrMsgTxt("Input is not supported.");
    }
    
    /* Test if it's possible to open the eyelink using a mex function */

    return;
    
}

    

    